package com.chis.netty.http.test;

import com.chis.netty.http.client.HttpsClient;

import java.util.Date;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2020年03月16日
 */
public class ThreadTest2 extends Thread {

    public ThreadTest2(String name){
//重写构造，可以对线程添加名字
        super(name);
    }

    @Override
    public void run() {
        Long l1 = new Date().getTime();
        try {
            HttpsClient.post("https://127.0.0.1:1443/test", "药监对接测试");
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println(" 本次耗时："+(new Date().getTime()-l1));
    }

    public static void main(String[] args){
        try {
            //并发
            for(int i = 0 ; i < 20 ; i++){
                ThreadTest2 threadRuning = new ThreadTest2("thread"+i);
                threadRuning.start();
            }
            //非并发
//            ThreadTest2 threadRuning = new ThreadTest2("thread");
//            for(int i = 0 ; i < 20 ; i++){
//                threadRuning.run();
//            }
        } catch (Exception e){
            e.printStackTrace();
        }


    }

}
